5f26f3
@@ -3513,7 +3513,7 @@
Integer genColListRegex(String colRegex, String tabAlias, ASTNode sel,
           pos = Integer.valueOf(pos.intValue() + 1);
           matched++;
 
-          if (unparseTranslator.isEnabled() || tableMask.isEnabled()) {
+          if (unparseTranslator.isEnabled() || (tableMask.isEnabled() && analyzeRewrite == null)) {
             if (replacementText.length() > 0) {
               replacementText.append(", ");
             }
@@ -11331,7 +11331,8 @@
void analyzeInternal(ASTNode ast, PlannerContext plannerCtx) throws SemanticExce
     // 2. Gen OP Tree from resolved Parse Tree
     Operator sinkOp = genOPTree(ast, plannerCtx);
 
-    if (!unparseTranslator.isEnabled() && tableMask.isEnabled()) {
+    if (!unparseTranslator.isEnabled() &&
+            (tableMask.isEnabled() && analyzeRewrite == null)) {
       // Here we rewrite the * and also the masking table
       ASTNode tree = rewriteASTWithMaskAndFilter(ast);
       if (tree != ast) {
